{include file="./layout/header.html" /}
<body>
<div class="x-body" >
    <form class="layui-form" id="intr">

        <div class="layui-form-item">
            <div class="layui-input-inline">
                <input   type="hidden" id="sid" name="sid" required="" lay-verify="required"
                         autocomplete="off" class="layui-input" placeholder="" value='{$sid}'>
            </div>
        </div>
        {notpresent name="$intr"}
            <div class="layui-form-item">
                <label for="gateway" class="layui-form-label">
                    <span class="x-red">*</span>支付网关
                </label>
                <div class="layui-input-inline">
                    <!--<input   type="text" id="gateway" name="gateway" required="" lay-verify="required"-->
                             <!--autocomplete="off" class="layui-input" placeholder="" value="PAY_EASE">-->
                    <select id="gateway" name="gateway" lay-verify="">
                        <option value="PAY_EASE">首信易</option>
                    </select>
                </div>
            </div>

            <div class="layui-form-item">
                <label for="pay_ease[mid]" class="layui-form-label">
                    <span class="x-red">*</span>首信易支付app_key
                </label>
                <div class="layui-input-inline">
                    <input   type="text" id="pay_ease[mid]" name="pay_ease[mid]" required="" lay-verify="required"
                             autocomplete="off" class="layui-input" placeholder="" value="">
                </div><span style="line-height: 37px"></span>
            </div>

            <div class="layui-form-item">
                <label for="pay_ease[secret_key]" class="layui-form-label">
                    <span class="x-red">*</span>首信易支付app_secret
                </label>
                <div class="layui-input-inline">
                    <input   type="text" id="pay_ease[secret_key]" name="pay_ease[secret_key]" required="" lay-verify="required"
                             autocomplete="off" class="layui-input" placeholder="">
                </div><span style="line-height: 37px"></span>
            </div>

            <div class="layui-form-item">
                <label for="pay_ease[return_url]" class="layui-form-label">
                    <span class="x-red">*</span>同步通知返回地址
                </label>
                <div class="layui-input-inline">
                    <input   type="text" id="pay_ease[return_url]" name="pay_ease[return_url]" required="" lay-verify="required"
                             autocomplete="off" class="layui-input" placeholder="">
                </div><span style="line-height: 37px"></span>
            </div>

        {/notpresent}

        {present name="$intr"}
        <div class="layui-form-item">
            <label for="gateway" class="layui-form-label">
                <span class="x-red">*</span>支付网关
            </label>
            <div class="layui-input-inline">
                <!--<input   type="text" id="gateway" name="gateway" required="" lay-verify="required"-->
                         <!--autocomplete="off" class="layui-input" placeholder="" value="{$intr->gateway}">-->
                <select id="gateway" name="gateway" lay-verify="">
                    <option value="{$intr->gateway}">{$intr->gateway}</option>
                    <option value="PAY_EASE">首信易</option>
                </select>
            </div>
        </div>

        <div class="layui-form-item">
            <label for="pay_ease[mid]" class="layui-form-label">
                <span class="x-red">*</span>首信易支付app_key
            </label>
            <div class="layui-input-inline">
                <input   type="text" id="pay_ease[mid]" name="pay_ease[mid]" required="" lay-verify="required"
                         autocomplete="off" class="layui-input" placeholder="" value="{$intr->pay_ease->mid}">
            </div><span style="line-height: 37px"></span>
        </div>

        <div class="layui-form-item">
            <label for="pay_ease[secret_key]" class="layui-form-label">
                <span class="x-red">*</span>首信易支付app_secret
            </label>
            <div class="layui-input-inline">
                <input   type="text" id="pay_ease[secret_key]" name="pay_ease[secret_key]" required="" lay-verify="required"
                         autocomplete="off" class="layui-input" placeholder="" value="{$intr->pay_ease->secret_key}">
            </div><span style="line-height: 37px"></span>
        </div>

        <div class="layui-form-item">
            <label for="pay_ease[return_url]" class="layui-form-label">
                <span class="x-red">*</span>同步通知返回地址
            </label>
            <div class="layui-input-inline">
                <input   type="text" id="pay_ease[return_url]" name="pay_ease[return_url]" required="" lay-verify="required"
                         autocomplete="off" class="layui-input" placeholder="" value="{$intr->pay_ease->return_url}">
            </div><span style="line-height: 37px"></span>
        </div>
         {/present}


        <div class="layui-form-item">
            <label  class="layui-form-label">
            </label>
            <button  class="layui-btn" lay-filter="add" lay-submit="">
                提交
            </button>
        </div>


    </form>
</div>

<!-- 加载编辑器的容器 -->
<script id="container" name="content" type="text/plain">
        这里写你的初始化内容
    </script>
<!-- 引入百度编辑器 -->
<script type="text/javascript" src="__CDN__/lib/ueditor/ueditor.config.js" charset="utf-8"></script>
<script type="text/javascript" src="__CDN__/lib/ueditor/ueditor.all.js" charset="utf-8"></script>
<!-- 实例化编辑器 -->
<script type="text/javascript">
    var ue = UE.getEditor('desc');
    var ue = UE.getEditor("['zh-CN']['content']");
    var ue = UE.getEditor("['en']['content']");
</script>
<script>
    layui.use(['form','layer'], function(){
        $ = layui.jquery;
        var form = layui.form
            ,layer = layui.layer;

        //监听提交
        form.on('submit(add)', function(data){
            // var str = new Array(); //定义一数组
            // str = uri$('#intr').serialize();
            var formData = $("#intr").serialize();

            console.log(formData);

            //发异步，把数据提交给php
            $.ajax({
                dataType : 'json',
                type : 'POST',
                url : '{:url("Conferpay/add")}',
                async: false,
                data : formData,
                success : function(msg){
                    layer.alert(msg.msg, {icon: 6},function () {
                        window.location.reload();
                        var index = parent.layer.getFrameIndex(window.name);
                        parent.layer.close(index);
                    });
                },
                error : function(XMLHttpRequest, textStatus, errorThrown) {
                    alert(XMLHttpRequest.status + "," + textStatus);
                }
            });

            return false;
        });


    });


</script>
{include file="./layout/footer.html" /}